<template>
  <div class="Web_Box" style="background: #fff;">
    <div class="Topmenu">
      <i @click="$utils.back" class="iconfont icon-youjiantou"><a href=""></a></i>
      <h1>淘只合伙人</h1>
      <span></span>
    </div>
    <div class="sjjinpaiimg"><img src="../../assets/images/sj.png" alt=""></div>
    <div v-for="item in chargeData" class="sjfuwu" style="border-bottom: 2px solid #f7f7f7;">
      <span style="font-weight: 600;">{{item.level_name}}</span>
      <span @click="upgradeNow(item)" class="ljsj">升级合伙人</span>
      <span class="jiage">￥{{item.exppoints}}</span>
    </div>
    <div class="sjjinpaiimg2"><img src="../../assets/images/sj2.jpg" alt=""></div>
  </div>
</template>

<script>
  import {mapModules, mapRules} from 'vuet'
  import payPop from '../../components/payPop'

  export default{
    mixins: [
      mapModules({memberInfo: 'memberInfo'}),
      mapRules({once: 'memberInfo'})
    ],
    data() {
      return {
        chargeData: [],
        chargeIng: false
      }
    },
    components: {
    },
    created() {
      this.getChargeVipData()
      window.onresize = this.$utils.throttle2(function() {
        console.log(window.screen.height)
      }, 600)
    },
    methods: {
      getChargeVipData() {
        this.$request.getVipChargeData().then(data => {
          data.splice(0, 1)
          this.chargeData = data
        }).finally(() => {
        })
      },
      upgradeNow(data) {
        if (this.chargeIng) return
        this.$request.chargeVipLevel(data.level, data.exppoints, data.period).then(resData => {
          console.log(resData.pay_sn)
          payPop({paySn: resData.pay_sn, payType: 1})
        }).catch(e => {
          this.$toast('预支付订单失败:' + e.msg)
        })
        console.log(data)
      }
    }
  }
</script>

<style>
</style>
